package a4;

public class Bigram implements Comparable{
	public String variable;
	public String condition;
	
	public Bigram(String variable, String condition){
		this.variable = variable;
		this.condition = condition;
	}
	
	public boolean equals(Object other){
		if(variable == ((Bigram)other).variable && condition == ((Bigram)other).condition){
			return true;
		}else{
			return false;
		}
	}
	
	public int compareTo(Object other){
	    if(variable == ((Bigram)other).variable && condition == ((Bigram)other).condition)
	        return 0;
	    else if (variable == ((Bigram)other).variable && condition.compareTo(((Bigram)other).condition) == 1)
	        return 1;
	    else if (variable == ((Bigram)other).variable && condition.compareTo(((Bigram)other).condition) == -1)
	        return -1;
	    else if (variable.compareTo(((Bigram)other).variable) == 1)
	        return 1;
	    else 
	        return -1;
	}
}
